//
//  YiChatClient.h
//  onlineCustoSDK
//
//  Created by 曹宗华 on 2017/12/8.
//  Copyright © 2017年 com.netinfosz. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HttpRequest.h"
#import "HttpRequestWithToken.h"
#import "AFNetworking.h"
#import "ClientInfo.h"
#import "CSDKDelegate.h"

typedef void (^successBlock)(NSString *info);
typedef void(^failureBlock)(NSError *error);
typedef void(^result)(NSData *data);
@interface YiChatClient : NSObject
@property(nonatomic,strong)NSString *appKey;
@property(nonatomic,strong)NSString *tenantId;
@property(nonatomic,strong)NSString *host;
@property(nonatomic,strong)NSString *port;
@property(nonatomic,strong)NSString *username;
@property(nonatomic,strong)NSString *token;
@property(nonatomic,strong)NSString *validateToken;
@property(nonatomic,strong)NSString *validateCode;
@property(nonatomic,strong)NSString *userId;
@property(nonatomic,strong)NSString *sessionId;
@property(nonatomic,strong)NSString *voiceLength;
@property(nonatomic,copy)result resultBlock;
@property(nonatomic,strong)HttpRequest *request;
@property(nonatomic,strong)HttpRequestWithToken *request2;
@property(nonatomic)BOOL  debugMode;
@property(nonatomic,strong)NSString *serverAddress;
@property(nonatomic,strong)NSString *skillId;
@property(nonatomic,strong)NSString  *transferId;
@property(nonatomic,strong)NSString *custAcctType;
+(instancetype)shareInstance;


@property (nonatomic, assign) id<CSDKDelegate> sdkDelegate;

//添加一个访客
- (void)addVisitorUserinfo:(NSDictionary*)userinfo Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//获取访客用户名
- (void)getVisitorNameSuccess:(successBlock)sucBlock fail:(failureBlock)failBlock;
//- (void)visitorLogin:(NSString*)username;
//访客登录
- (void)visitorLogin:(NSString*)username Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//创建会话
- (void)createSessionSuccess:(successBlock) sucBlock fail:(failureBlock)failBlock;
//创建会话  增加了3个参数
- (void)createSessionSkillId:(NSString*)skillId Level:(int)level callData:(NSDictionary*)callData Success:(successBlock) sucBlock fail:(failureBlock)failBlock;
//获取排队人数
- (void)getQueueInfoSuccess:(successBlock) sucBlock fail:(failureBlock)failBlock;
//取消排队
- (void)cancelQueueSuccess:(successBlock)sucBlock;
//获取最新会话
- (void)getLatestSessionSuccess:(successBlock) sucBlock fail:(failureBlock)failBlock;
//下载文件
- (NSData*)getFile:(NSString*)url;
//上传文件
- (void)uploadFile:(NSData*)data type:(NSString*)fileType;
//结束会话
- (void)dropSession;
//结束会话2
- (void)dropSession:(NSString*)sessionId Success:(successBlock)sucBlock;
//发送消息1
- (void)sendMessage:(NSString*)content type:(NSString*)type;
//发送回执消息
- (void)sendReceipt:(NSString*)notifyId;
//发送消息
- (void)sendMessage:(NSString*)content type:(NSString*)type Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//转人工
- (void)transferToAgent;

/* 转人工
 * @param cmp 发起转人工回调, error: 如果有错误则会返回错误码，成功则为nil
 */
- (void)transferToAgentCompleted:(void (^)(NSError *error))cmp;

//获取评价选项
- (void)getEvaluationOptionsSuccess:(successBlock)sucBlock fail:(failureBlock)failBlock;
//评价客服
- (void)evalutionLevel:(int) level Content:(NSString*)evaluationContent Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//评价客服2
- (void)evalutionTransferId:(NSString*)transferId Level:(int) level Content:(NSString*)content Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//满意度评价机器人
- (void)evaluationRobotAccesssId:(NSString*)accessId Level:(int)level Content:(NSString*)content Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//获取Validatetoken
- (void)getTokenSuccess:(successBlock)sucBlock;
//获取验证码
- (UIImage*)getValidateCode;
//获取验证码2
- (UIImage*)getValidateCodeWithToken:(NSString*)Validatetoken;
//验证帐号和密码接口
- (void)validateAount:(NSString*)account password:(NSString*)password Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//验证帐号和密码接口
- (void)validateAount:(NSString*)custAcctNo password:(NSString*)password ValidateCode:(NSString*)validatecode CustAcctType:(NSString*)custAcctType Token:(NSString*)token PubKey:(NSString*)pubkey Syscode:(NSString*)systemcode Need:(BOOL)feedBack Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//增加留言
- (void)addLeftMessage:(NSDictionary*)message Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
// 机器人反馈
/**
 *param,(NSDictionary*)
 包含(NSString*)question，(NSString*)answer，(NSString*)type
 *
 **/
- (void)feedbackRobot:(NSDictionary*)param Success:(successBlock)sucBlock;
//继续业务办理
/**
 *参数1：(NSString*)code 业务办理代码
 *参数2:(NSString*)IDinfo加密后的身份信息
 *参数3:(successBlock)sucBlock 接口调用成功后的响应信息
 */
- (void)continueBusi:(NSString*)code validateInfo:(NSString*)IDinfo Success:(successBlock)sucBlock;
//敏感词检测
- (void)detectSensitiveWords:(NSString*)text Success:(successBlock)sucBlock fail:(failureBlock)failBlock;
//获取热点问题
//param参数，包含几个字段：mode:int类型,channelId:int类型,brand：NSString类型,size:int整型，type：默认是@"text"
- (void)getHotQuestions:(NSDictionary*)param Success:(successBlock)sucBlock;

/// 获取智能提示
/// @param content 用户输入的问题
/// @param channelId 渠道Id
/// @param brand 品牌
/// @param size 获取智能提示的条数
/// @param successBlock successBlock
/// @param failBlock failBlock description
-(void)getSuggestedQuestionWithContent:(NSString *)content ChannelId:(int)channelId Brand:(NSString *)brand Size:(int)size Success:(successBlock)successBlock fail:(failureBlock)failBlock;



///// 获取App客户端配置
///// @param appKey appKey
-(void)getAppConfigWithAppKey:(NSString *)appKey
                      Success:(successBlock)successBlock
                         fail:(failureBlock)failBlock;
@end
